package com.qcby.service.impl;

import com.github.pagehelper.PageHelper;
import com.qcby.common.WrongQuestion.ShowByPage;
import com.qcby.dao.WrongQuestionDao;
import com.qcby.entity.ErrorCollection;
import com.qcby.entity.Result;
import com.qcby.service.WrongQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WrongQuestionServiceImpl implements WrongQuestionService {

    @Autowired
    WrongQuestionDao wrongQuestionDao;

    @Override
    public Result<List<ErrorCollection>> showErrorCollectionByPage(ShowByPage info) {
        info.setOffset(info.getPageSize()*(info.getPage()-1));

        System.out.println(info);
        System.out.println(wrongQuestionDao.showErrorCollectionByPage(info));
        return Result.success(wrongQuestionDao.showErrorCollectionByPage(info));
    }

    @Override
    public Result<Integer> getErrorCollectionCount(String student) {
        return Result.success(wrongQuestionDao.getErrorCollectionCount(student));
    }

    @Override
    public Result<Integer> deleteErrorCollection(int id) {
        return Result.success(wrongQuestionDao.deleteErrorCollection(id));
    }

    @Override
    public List<ErrorCollection> GetWrongQuestionByIds(List<Integer> list) {
        return wrongQuestionDao.GetWrongQuestionByIds(list);
    }
}
